function Y = imgClose (I, r)
%IMGCLOSE uzavre olbasti v binarnim obrazku I
%         pouzije se dilatace a eroze s polomerem r
[A, B] = size(I);
J = logical(zeros(A+2*r, B+2*r, 'uint32'));
J((r+1):(r+A), (r+1):(r+B)) = I;
m = strel('disk', 5);
J = imdilate(J,m);
J = imerode(J,m);
Y = J((r+1):(r+A), (r+1):(r+B));
end

